package com.study.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * RestFulController class
 *
 * @author chenyeqing
 * @date 2021/3/9
 */
@Controller
public class RestFulController {

    @GetMapping(value = {"/add/{a}/{b}", "xxx/{a}/{b}"})
    public String test01(@PathVariable int a, @PathVariable int b, Model model) {
        int res = a + b;
        model.addAttribute("msg", "结果为" + res);
        return "test";
    }

    @RequestMapping(value = "/add/{a}/{b}", method = RequestMethod.POST)
    @ResponseBody
    public String test02() {
        return "post";
    }
}
